import request from '@/api/axios'
import {AxiosPromise} from 'axios'
import {DataRecordList} from '@/api/config'

export interface UploadPlatformParams {
  phyDate?: Array<string> // 体检日期
  startTime?: string // 开始日期
  endTime?: string // 结束日期
  teamId?: string // 团队id
  idNo?: string // 身份证
  isUpload?: number //是否上传
  uploadStatus?: number // 上传状态
  page?: number // 页码
  limit?: number // 每页条数
}

export interface UploadPlatformList {
  id: string
  checkupNo: string // 体检ID
  gwOrgCode: string // 单位编码
}

/**
 * @description: 检验结果审核查询
 * @param {UploadPlatformParams} params
 * @return {*}
 */
export const getUploadPlatformList = (params: UploadPlatformParams): AxiosPromise<DataRecordList<UploadPlatformList>> => {
  return request({
    url: '/api/platformUpload/page',
    method: 'get',
    params
  })
}

/**
 * @description: 导出数据
 * @param {Array} data
 * @return {*}
 */
export const exportPlatform = (params: UploadPlatformParams): AxiosPromise<ArrayBuffer> => {
  return request({
    url: '/api/platformUpload/export',
    method: 'get',
    params,
    responseType: 'arraybuffer' || 'json'
  })
}
